import time

from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

# 模拟键盘操作

from utils.webdriver_factory import WebDriverFactory

driver = WebDriverFactory.get_instance()

driver.maximize_window()
driver.get("http://www.baidu.com")
key_box = driver.find_element(By.ID, "kw")
key_box.send_keys("Java")
time.sleep(1)
key_box.send_keys(Keys.CONTROL, 'a')
time.sleep(1)
key_box.send_keys(Keys.CONTROL, 'c')
time.sleep(1)
key_box.send_keys(Keys.BACKSPACE)
time.sleep(1)
key_box.send_keys(Keys.CONTROL, 'v')
time.sleep(3)
driver.quit()
